/*    *//*
 package com.gillion.grule.client.logger;
*/
/*    *//*

*/
/*    *//*
 import com.gillion.esb.api.util.EntityUtils;
*/
/*    *//*
 import java.util.Properties;
*/
/*    *//*
 import org.apache.kafka.clients.producer.KafkaProducer;
*/
/*    *//*
 import org.apache.kafka.clients.producer.ProducerRecord;
*/
/*    *//*
 import org.slf4j.Logger;
*/
/*    *//*
 import org.slf4j.LoggerFactory;
*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*
 public class KafkaExecutorLogger
*/
/*    *//*
   implements ExecutorLogger
*/
/*    *//*
 {
*/
/*    *//*
   KafkaProducer<String, String> kafkaProducer;
*/
/*    *//*
   private String logTopic;
*/
/*    *//*
   private String servers;
*/
/*    *//*
   private String keySerializer;
*/
/*    *//*
   private String valueSerializer;
*/
/* 24 *//*
   private static final Logger LOGGER = LoggerFactory.getLogger(KafkaExecutorLogger.class);
*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*
   public void init() {
*/
/* 31 *//*
     setLogTopic(this.logTopic);
*/
/* 32 *//*
     Properties props = new Properties();
*/
/*    *//*

*/
/* 34 *//*
     props.put("bootstrap.servers", this.servers);
*/
/* 35 *//*
     props.put("key.serializer", this.keySerializer);
*/
/* 36 *//*
     props.put("value.serializer", this.valueSerializer);
*/
/* 37 *//*
     props.put("producer.type", "async");
*/
/* 38 *//*
     props.put("request.required.acks", "1");
*/
/* 39 *//*
     KafkaProducer<String, String> producer = new KafkaProducer(props);
*/
/* 40 *//*
     setKafkaProducer(producer);
*/
/*    *//*
   }
*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*
   public void log(BaseLog log) {
*/
/* 46 *//*
     if (this.logTopic != null) {
*/
/* 47 *//*
       if (this.kafkaProducer != null) {
*/
/*    *//*
         try {
*/
/* 49 *//*
           ProducerRecord producerRecord = new ProducerRecord(this.logTopic, EntityUtils.toJSONString(log));
*/
/* 50 *//*
           this.kafkaProducer.send(producerRecord);
*/
/* 51 *//*
         } catch (Exception e) {
*/
/* 52 *//*
           e.printStackTrace();
*/
/* 53 *//*
           LOGGER.error("发送出现问题", e);
*/
/*    *//*
         }
*/
/*    *//*
       } else {
*/
/* 56 *//*
         throw new RuntimeException("KafkaProducer cannot be null");
*/
/*    *//*
       }
*/
/*    *//*
     } else {
*/
/* 59 *//*
       throw new RuntimeException("Kafka topic cannot be null");
*/
/*    *//*
     }
*/
/*    *//*
   }
*/
/*    *//*

*/
/*    *//*
   public void setKafkaProducer(KafkaProducer<String, String> kafkaProducer) {
*/
/* 64 *//*
     this.kafkaProducer = kafkaProducer;
*/
/*    *//*
   }
*/
/*    *//*

*/
/*    *//*
   public void setLogTopic(String logTopic) {
*/
/* 68 *//*
     this.logTopic = logTopic;
*/
/*    *//*
   }
*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*

*/
/*    *//*
   public void close() {
*/
/* 75 *//*
     this.kafkaProducer.close();
*/
/*    *//*
   }
*/
/*    *//*

*/
/*    *//*
   public void setServers(String servers) {
*/
/* 79 *//*
     this.servers = servers;
*/
/*    *//*
   }
*/
/*    *//*

*/
/*    *//*
   public void setKeySerializer(String keySerializer) {
*/
/* 83 *//*
     this.keySerializer = keySerializer;
*/
/*    *//*
   }
*/
/*    *//*

*/
/*    *//*
   public void setValueSerializer(String valueSerializer) {
*/
/* 87 *//*
     this.valueSerializer = valueSerializer;
*/
/*    *//*
   }
*/
/*    *//*
 }


*/
/* Location:              D:\apache-tomcat-9.0.76\webapps\grule-manager\WEB-INF\lib\grule-client-2.0.2.RELEASE.jar!\com\gillion\grule\client\logger\KafkaExecutorLogger.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */
